﻿using System;
using System.Collections.Generic;
using System.Text;
using DreamShield.Deployment.Installers.DreamWorker.Workers;
using DreamShield.Deployment.Installers.DreamWorker;
using DreamShield.Deployment.Wizards.Workflow;
using DreamShield.Deployment.Package;
using DreamShield.Deployment.Driver.Native;
using DreamShield.Deployment.Driver.Indexer;
using DreamShield.IO.Utils.BackupStorage;

namespace DreamShield.Deployment.Miles.Events
{
    /// <summary>
    /// Classe offrant la possibilité d'intercepter les évènements
    /// d'installation du package en cours
    /// </summary>
    public class EventsProvider_Package : BaseMilesPlugin
    {
        /// <summary>
        /// Construit une nouvelle instance du fournisseur d'évènements du package
        /// </summary>
        /// <param name="server">Serveur Miles en cours</param>
        public EventsProvider_Package(MilesRootServer server)
            : base(server)
        {
            NativePluginInstance = new NativePlugin(this);

            _NativePluginImplementation = NativePluginInstance;
            _NativePluginType = PackageWorker.PluginsGuid;
        }

        #region Liason avec DreamShield

        /// <summary>
        /// Instance native de plugin DreamShield
        /// </summary>
        protected virtual NativePlugin NativePluginInstance { get; set; }

        /// <summary>
        /// Classe de liaison avec le runtime DreamShield
        /// </summary>
        protected class NativePlugin : BasePackageWorker_Plugin
        {
            /// <summary>
            /// Fournisseur parent
            /// </summary>
            public virtual EventsProvider_Package Owner { get; protected set; }

            /// <summary>
            /// Crée une nouvelle classe de liaison avec le runtime DreamShield
            /// </summary>
            /// <param name="owner">Fournisseur parent</param>
            public NativePlugin(EventsProvider_Package owner)
            {
                Owner = owner;
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="ActionId"></param>
            /// <param name="componentFlow"></param>
            /// <param name="component"></param>
            public override void AfterGenerate_ExecuteComponent(DreamWorkerEngine target, WorkerActionId ActionId, WorkflowSequencer componentFlow, PackageComponent component)
            {
                base.AfterGenerate_ExecuteComponent(target, ActionId, componentFlow, component);

                Owner.AfterGenerate_ExecuteComponent(target, ActionId, component);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="ActionId"></param>
            /// <param name="packageFlow"></param>
            public override void AfterGenerate_ExecuteInstallation_AfterComponents(DreamWorkerEngine target, WorkerActionId ActionId, WorkflowSequencer packageFlow)
            {
                base.AfterGenerate_ExecuteInstallation_AfterComponents(target, ActionId, packageFlow);

                Owner.AfterGenerate_ExecuteInstallation_AfterComponents(target, ActionId);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="ActionId"></param>
            /// <param name="packageFlow"></param>
            public override void AfterGenerate_ExecuteInstallation_BeforeComponents(DreamWorkerEngine target, WorkerActionId ActionId, WorkflowSequencer packageFlow)
            {
                base.AfterGenerate_ExecuteInstallation_BeforeComponents(target, ActionId, packageFlow);
                Owner.AfterGenerate_ExecuteInstallation_BeforeComponents(target, ActionId);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="packageFlow"></param>
            public override void AfterGenerate_RollBack(DreamWorkerEngine target, WorkflowSequencer packageFlow)
            {
                base.AfterGenerate_RollBack(target, packageFlow);
                Owner.AfterGenerate_RollBack(target);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void AfterRegisterPackage()
            {
                base.AfterRegisterPackage();
                Owner.AfterRegisterPackage();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void AfterUnRegisterPackage()
            {
                base.AfterUnRegisterPackage();
                Owner.AfterUnRegisterPackage();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void AfterUnRegisterPackage_Effective()
            {
                base.AfterUnRegisterPackage_Effective();
                Owner.AfterUnRegisterPackage_Effective();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void AfterUpdateExplorerIcons()
            {
                base.AfterUpdateExplorerIcons();
                Owner.AfterUpdateExplorerIcons();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="ActionId"></param>
            /// <param name="componentFlow"></param>
            /// <param name="component"></param>
            public override void BeforeGenerate_ExecuteComponent(DreamWorkerEngine target, WorkerActionId ActionId, WorkflowSequencer componentFlow, PackageComponent component)
            {
                base.BeforeGenerate_ExecuteComponent(target, ActionId, componentFlow, component);
                Owner.BeforeGenerate_ExecuteComponent(target, ActionId, component);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="ActionId"></param>
            /// <param name="packageFlow"></param>
            public override void BeforeGenerate_ExecuteInstallation_AfterComponents(DreamWorkerEngine target, WorkerActionId ActionId, WorkflowSequencer packageFlow)
            {
                base.BeforeGenerate_ExecuteInstallation_AfterComponents(target, ActionId, packageFlow);
                Owner.BeforeGenerate_ExecuteInstallation_AfterComponents(target, ActionId);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="ActionId"></param>
            /// <param name="packageFlow"></param>
            public override void BeforeGenerate_ExecuteInstallation_BeforeComponents(DreamWorkerEngine target, WorkerActionId ActionId, WorkflowSequencer packageFlow)
            {
                base.BeforeGenerate_ExecuteInstallation_BeforeComponents(target, ActionId, packageFlow);
                Owner.BeforeGenerate_ExecuteInstallation_BeforeComponents(target, ActionId);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="target"></param>
            /// <param name="packageFlow"></param>
            public override void BeforeGenerate_RollBack(DreamWorkerEngine target, WorkflowSequencer packageFlow)
            {
                base.BeforeGenerate_RollBack(target, packageFlow);
                Owner.BeforeGenerate_RollBack(target);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void BeforeRegisterPackage()
            {
                base.BeforeRegisterPackage();
                Owner.BeforeRegisterPackage();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void BeforeUnRegisterPackage()
            {
                base.BeforeUnRegisterPackage();
                Owner.BeforeUnRegisterPackage();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void BeforeUnRegisterPackage_Effective()
            {
                base.BeforeUnRegisterPackage_Effective();
                Owner.BeforeUnRegisterPackage_Effective();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            public override void BeforeUpdateExplorerIcons()
            {
                base.BeforeUpdateExplorerIcons();
                Owner.BeforeUpdateExplorerIcons();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="del"></param>
            public override void OnUnRegisterPackage_Effective(DreamShield.Deployment.Driver.Indexer.LocalProductIndexEntry del)
            {
                base.OnUnRegisterPackage_Effective(del);
                Owner.OnUnRegisterPackage_Effective();
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="Package"></param>
            /// <param name="entry"></param>
            /// <param name="backupEntry"></param>
            public override void RegisterPackage_AfterInstallRuntime(InstallationPackage Package, DreamShield.Deployment.Driver.Indexer.LocalProductIndexEntry entry, DreamShield.IO.Utils.BackupStorage.BackupEntry backupEntry)
            {
                base.RegisterPackage_AfterInstallRuntime(Package, entry, backupEntry);
                Owner.RegisterPackage_AfterInstallRuntime(Package);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="unist_key"></param>
            public override void RegisterPackage_AfterPlatformRegistration(DreamShield.Deployment.Driver.Native.UninstallInformations unist_key)
            {
                base.RegisterPackage_AfterPlatformRegistration(unist_key);
                Owner.RegisterPackage_AfterPlatformRegistration(unist_key);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="Package"></param>
            /// <param name="entry"></param>
            /// <param name="backupEntry"></param>
            public override void RegisterPackage_BeforeInstallRuntime(InstallationPackage Package, LocalProductIndexEntry entry, BackupEntry backupEntry)
            {
                base.RegisterPackage_BeforeInstallRuntime(Package, entry, backupEntry);
                Owner.RegisterPackage_BeforeInstallRuntime(Package);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="unist_key"></param>
            public override void RegisterPackage_BeforePlatformRegistration(UninstallInformations unist_key)
            {
                base.RegisterPackage_BeforePlatformRegistration(unist_key);
                Owner.RegisterPackage_BeforePlatformRegistration(unist_key);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="title"></param>
            /// <param name="message"></param>
            /// <param name="ex"></param>
            /// <param name="shouldPassToEngine"></param>
            public override void ReportFailure(string title, string message, Exception ex, ref bool shouldPassToEngine)
            {
                base.ReportFailure(title, message, ex, ref shouldPassToEngine);
                Owner.ReportFailure(title, message, ex, ref shouldPassToEngine);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="title"></param>
            /// <param name="message"></param>
            /// <param name="shouldPassToEngine"></param>
            public override void ReportMessage(string title, string message, ref bool shouldPassToEngine)
            {
                base.ReportMessage(title, message, ref shouldPassToEngine);
                Owner.ReportMessage(title, message, ref shouldPassToEngine);
            }

            /// <summary>
            /// Infrastructure
            /// </summary>
            /// <param name="title"></param>
            /// <param name="message"></param>
            /// <param name="optionnalException"></param>
            /// <param name="shouldPassToEngine"></param>
            public override void ReportWarning(string title, string message, Exception optionnalException, ref bool shouldPassToEngine)
            {
                base.ReportWarning(title, message, optionnalException, ref shouldPassToEngine);
                Owner.ReportWarning(title, message, optionnalException, ref shouldPassToEngine);
            }
        }

        #endregion

        /// <summary>
        /// Evènement de gestion de package
        /// </summary>
        /// <param name="package">package concerné</param>
        public delegate void PackageEventHandler(InstallationPackage package);

        /// <summary>
        /// Evènement de gestion du moteur d'installation
        /// </summary>
        /// <param name="target">moteur d'installation concerné</param>
        public delegate void WorkerEngineEventHandler(DreamWorkerEngine target);

        /// <summary>
        /// Evènement de gestion du moteur d'installation, dans le mode spécifié
        /// </summary>
        /// <param name="target">moteur d'installation concerné</param>
        /// <param name="ActionId">mode</param>
        public delegate void WorkerEngineWithActionEventHandler(DreamWorkerEngine target, WorkerActionId ActionId);

        /// <summary>
        /// Evènement de gestion des informations de désinstallation (usuellement dans le registre)
        /// </summary>
        /// <param name="infos">Informations</param>
        public delegate void UninstallInformationsEventHandler(UninstallInformations infos);

        /// <summary>
        /// Evènement de notification d'une activité sur un composant
        /// </summary>
        /// <param name="target">moteur d'installation concerné</param>
        /// <param name="ActionId">action effectuée</param>
        /// <param name="component">composant affecté</param>
        public delegate void ComponentNotificationEventHandler(DreamWorkerEngine target, WorkerActionId ActionId, PackageComponent component);

        /// <summary>
        /// Evènement de passage d'une exception
        /// </summary>
        /// <param name="title">titre</param>
        /// <param name="message">message</param>
        /// <param name="optionnalException">objet Exception correspondant (peut être null)</param>
        /// <param name="shouldPassToEngine">indique si le message doit être retransmis vers le runtime DreamShield pour traitement (sinon il sera ignoré)</param>
        public delegate void ExceptionPassageEventHandler(string title, string message, Exception optionnalException, ref bool shouldPassToEngine);
        
        /// <summary>
        /// Evènement de passage d'un message
        /// </summary>
        /// <param name="title">titre</param>
        /// <param name="message">message</param>
        /// <param name="shouldPassToEngine">indique si le message doit être retransmis vers le runtime DreamShield pour traitement (sinon il sera ignoré)</param>
        public delegate void MessagePassageEventHandler(string title, string message, ref bool shouldPassToEngine);

        /// <summary>
        /// Appelé après la génération des actions concernant un composant
        /// </summary>
        public event ComponentNotificationEventHandler AfterGenerate_ExecuteComponent_Handler;

        /// <summary>
        /// Provoque l'évènement AfterGenerate_ExecuteComponent_Handler
        /// </summary>
        /// <param name="target"></param>
        /// <param name="ActionId"></param>
        /// <param name="component"></param>
        protected virtual void AfterGenerate_ExecuteComponent(DreamWorkerEngine target, WorkerActionId ActionId, PackageComponent component)
        {
            if (AfterGenerate_ExecuteComponent_Handler != null)
                AfterGenerate_ExecuteComponent_Handler(target, ActionId, component);
        }

        /// <summary>
        /// Appellé après que le Worker ne génère les actions de configuration d'un package devant se produire après
        /// la génération des actions des composants
        /// </summary>
        public event WorkerEngineWithActionEventHandler AfterGenerate_ExecuteInstallation_AfterComponents_Handler;
        
        /// <summary>
        /// Provoque l'évènement AfterGenerate_ExecuteInstallation_AfterComponents
        /// </summary>
        /// <param name="target"></param>
        /// <param name="ActionId"></param>
        protected virtual void AfterGenerate_ExecuteInstallation_AfterComponents(DreamWorkerEngine target, WorkerActionId ActionId)
        {
            if (AfterGenerate_ExecuteInstallation_AfterComponents_Handler != null)
                AfterGenerate_ExecuteInstallation_AfterComponents_Handler(target, ActionId);
        }

        /// <summary>
        /// Appellé lorsqu'un avertissement (usuellement une erreur mineur) survient pendant l'opération
        /// </summary>
        public event ExceptionPassageEventHandler OnWarning;

        /// <summary>
        /// Provoque l'évènement OnWarning
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="optionnalException"></param>
        /// <param name="shouldPassToEngine"></param>
        protected virtual void ReportWarning(string title, string message, Exception optionnalException, ref bool shouldPassToEngine)
        {
            if (OnWarning != null)
                OnWarning(title, message, optionnalException, ref shouldPassToEngine);
        }

        /// <summary>
        /// Appellé à chaque fois qu'un message est notifié à l'installeur
        /// </summary>
        public event MessagePassageEventHandler OnMessage;

        /// <summary>
        /// Provoque l'évènement OnMessage
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="shouldPassToEngine"></param>
        protected virtual void ReportMessage(string title, string message, ref bool shouldPassToEngine)
        {
            if (OnMessage != null)
                OnMessage(title, message, ref shouldPassToEngine);
        }

        /// <summary>
        /// Appellé lorsqu'une erreur grave survient dans l'installation
        /// </summary>
        public event ExceptionPassageEventHandler OnFailure;

        /// <summary>
        /// Provoque l'évènement OnFailure
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="ex"></param>
        /// <param name="shouldPassToEngine"></param>
        protected virtual void ReportFailure(string title, string message, Exception ex, ref bool shouldPassToEngine)
        {
            if (OnFailure != null)
                OnFailure(title, message, ex, ref shouldPassToEngine);
        }

        /// <summary>
        /// Appellé avant que l'installeur n'enregistre les informations relatives à l'application en train
        /// d'être installée sur l'ordinateur cible
        /// </summary>
        public event UninstallInformationsEventHandler RegisterPackage_BeforePlatformRegistration_Handler;

        /// <summary>
        /// Provoque l'évènement RegisterPackage_BeforePlatformRegistration_Handler
        /// </summary>
        /// <param name="unist_key"></param>
        protected virtual void RegisterPackage_BeforePlatformRegistration(UninstallInformations unist_key)
        {
            if (RegisterPackage_BeforePlatformRegistration_Handler != null)
                RegisterPackage_BeforePlatformRegistration_Handler(unist_key);
        }

        /// <summary>
        /// Appellé avant l'installation du Runtime de DreamShield
        /// </summary>
        public event PackageEventHandler RegisterPackage_BeforeInstallRuntime_Handler;

        /// <summary>
        /// Provoque l'évènement RegisterPackage_BeforeInstallRuntime_Handler
        /// </summary>
        /// <param name="Package"></param>
        protected virtual void RegisterPackage_BeforeInstallRuntime(InstallationPackage Package)
        {
            if (RegisterPackage_BeforeInstallRuntime_Handler != null)
                RegisterPackage_BeforeInstallRuntime_Handler(Package);
        }

        /// <summary>
        /// Appellé après que l'installeur n'enregistre les informations relatives à l'application en train
        /// d'être installée sur l'ordinateur cible
        /// </summary>
        public event UninstallInformationsEventHandler RegisterPackage_AfterPlatformRegistration_Handler;

        /// <summary>
        /// Provoque l'évènement RegisterPackage_AfterPlatformRegistration_Handler
        /// </summary>
        /// <param name="unist_key"></param>
        protected virtual void RegisterPackage_AfterPlatformRegistration(UninstallInformations unist_key)
        {
            if (RegisterPackage_AfterPlatformRegistration_Handler != null)
                RegisterPackage_AfterPlatformRegistration_Handler(unist_key);
        }

        /// <summary>
        /// Appellé après l'installation du Runtime de DreamShield
        /// </summary>
        public event PackageEventHandler RegisterPackage_AfterInstallRuntime_Handler;

        /// <summary>
        /// Provoque l'évènement RegisterPackage_AfterInstallRuntime_Handler
        /// </summary>
        /// <param name="Package"></param>
        protected virtual void RegisterPackage_AfterInstallRuntime(InstallationPackage Package)
        {
            if (RegisterPackage_AfterInstallRuntime_Handler != null)
                RegisterPackage_AfterInstallRuntime_Handler(Package);
        }

        /// <summary>
        /// Appellé après la suppression effective des enregistrement du produit
        /// </summary>
        public event EventHandler OnUnRegisterPackage_Effective_Handler;

        /// <summary>
        /// Provoque l'évènement OnUnRegisterPackage_Effective_Handler
        /// </summary>
        protected virtual void OnUnRegisterPackage_Effective()
        {
            if (OnUnRegisterPackage_Effective_Handler != null)
                OnUnRegisterPackage_Effective_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appellé avant que les icônes de l'explorateur ne soient mises à jour par l'installeur
        /// </summary>
        public event EventHandler BeforeUpdateExplorerIcons_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeUpdateExplorerIcons_Handler
        /// </summary>
        protected virtual void BeforeUpdateExplorerIcons()
        {
            if (BeforeUpdateExplorerIcons_Handler != null)
                BeforeUpdateExplorerIcons_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appellé avant la suppression effective des enregistrements du produit
        /// </summary>
        public event EventHandler BeforeUnRegisterPackage_Effective_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeUnRegisterPackage_Effective_Handler
        /// </summary>
        protected virtual void BeforeUnRegisterPackage_Effective()
        {
            if (BeforeUnRegisterPackage_Effective_Handler != null)
                BeforeUnRegisterPackage_Effective_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appellé avant la suppression des enregistrements du produit
        /// </summary>
        public event EventHandler BeforeUnRegisterPackage_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeUnRegisterPackage
        /// </summary>
        protected virtual void BeforeUnRegisterPackage()
        {
            if (BeforeUnRegisterPackage_Handler != null)
                BeforeUnRegisterPackage_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appellé avant l'inscription des enregistrements du produit
        /// </summary>
        public event EventHandler BeforeRegisterPackage_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeRegisterPackage_Handler
        /// </summary>
        protected virtual void BeforeRegisterPackage()
        {
            if (BeforeRegisterPackage_Handler != null)
                BeforeRegisterPackage_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appellé avant la génération des actions d'annulation
        /// </summary>
        public event WorkerEngineEventHandler BeforeGenerate_RollBack_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeGenerate_RollBack_Handler
        /// </summary>
        /// <param name="target"></param>
        protected virtual void BeforeGenerate_RollBack(DreamWorkerEngine target)
        {
            if (BeforeGenerate_RollBack_Handler != null)
                BeforeGenerate_RollBack_Handler(target);
        }

        /// <summary>
        /// Appellé avant que le Worker ne génère les actions de configuration d'un package devant se produire avant
        /// la génération des actions des composants
        /// </summary>
        public event WorkerEngineWithActionEventHandler BeforeGenerate_ExecuteInstallation_BeforeComponents_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeGenerate_ExecuteInstallation_BeforeComponents_Handler
        /// </summary>
        /// <param name="target"></param>
        /// <param name="ActionId"></param>
        protected virtual void BeforeGenerate_ExecuteInstallation_BeforeComponents(DreamWorkerEngine target, WorkerActionId ActionId)
        {
            if (BeforeGenerate_ExecuteInstallation_BeforeComponents_Handler != null)
                BeforeGenerate_ExecuteInstallation_BeforeComponents_Handler(target, ActionId);
        }

        /// <summary>
        /// Appellé avant que le Worker ne génère les actions de configuration d'un package devant se produire après
        /// la génération des actions des composants
        /// </summary>
        public event WorkerEngineWithActionEventHandler BeforeGenerate_ExecuteInstallation_AfterComponents_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeGenerate_ExecuteInstallation_AfterComponents_Handler
        /// </summary>
        /// <param name="target"></param>
        /// <param name="ActionId"></param>
        protected virtual void BeforeGenerate_ExecuteInstallation_AfterComponents(DreamWorkerEngine target, WorkerActionId ActionId)
        {
            if (BeforeGenerate_ExecuteInstallation_AfterComponents_Handler != null)
                BeforeGenerate_ExecuteInstallation_AfterComponents_Handler(target, ActionId);
        }

        /// <summary>
        /// Appelé avant la génération des actions sur un composant
        /// </summary>
        public event ComponentNotificationEventHandler BeforeGenerate_ExecuteComponent_Handler;

        /// <summary>
        /// Provoque l'évènement BeforeGenerate_ExecuteComponent_Handler
        /// </summary>
        /// <param name="target"></param>
        /// <param name="ActionId"></param>
        /// <param name="component"></param>
        protected virtual void BeforeGenerate_ExecuteComponent(DreamWorkerEngine target, WorkerActionId ActionId, PackageComponent component)
        {
            if (BeforeGenerate_ExecuteComponent_Handler != null)
                BeforeGenerate_ExecuteComponent_Handler(target, ActionId, component);
        }

        /// <summary>
        /// Appelé après la mise à jour des icônes de l'explorateur Windows par DreamShield (usuellement, à la fin d'une installation réussie)
        /// </summary>
        public event EventHandler AfterUpdateExplorerIcons_Handler;

        /// <summary>
        /// Provoque l'évènement AfterUpdateExplorerIcons_Handler
        /// </summary>
        protected virtual void AfterUpdateExplorerIcons()
        {
            if (AfterUpdateExplorerIcons_Handler != null)
                AfterUpdateExplorerIcons_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appelé après la suppression effective des enregistrements pour l'installation
        /// </summary>
        public event EventHandler AfterUnRegisterPackage_Effective_Handler;

        /// <summary>
        /// Provoque l'évènement AfterUnRegisterPackage_Effective_Handler
        /// </summary>
        protected virtual void AfterUnRegisterPackage_Effective()
        {
            if (AfterUnRegisterPackage_Effective_Handler != null)
                AfterUnRegisterPackage_Effective_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appelé après l'enregistrement d'une package par DreamShield
        /// </summary>
        public event EventHandler AfterUnRegisterPackage_Handler;

        /// <summary>
        /// Provoque l'évènement AfterUnRegisterPackage_Handler
        /// </summary>
        protected virtual void AfterUnRegisterPackage()
        {
            if (AfterUnRegisterPackage_Handler != null)
                AfterUnRegisterPackage_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appellé après l'enregistrement d'un package
        /// </summary>
        public event EventHandler AfterRegisterPackage_Handler;

        /// <summary>
        /// Provoque l'évènement AfterRegisterPackage_Handler
        /// </summary>
        protected virtual void AfterRegisterPackage()
        {
            if (AfterRegisterPackage_Handler != null)
                AfterRegisterPackage_Handler(this, EventArgs.Empty);
        }

        /// <summary>
        /// Appelé après la génération des actions d'annulation (installation annulée ou ayant rencontrée une erreur)
        /// </summary>
        public event WorkerEngineEventHandler AfterGenerate_RollBack_Handler;

        /// <summary>
        /// Provoque l'évènement AfterGenerate_RollBack_Handler
        /// </summary>
        /// <param name="target"></param>
        protected virtual void AfterGenerate_RollBack(DreamWorkerEngine target)
        {
            if (AfterGenerate_RollBack_Handler != null)
                AfterGenerate_RollBack_Handler(target);
        }

        /// <summary>
        /// Appelé après l'exécution de la génération des actions sur un composant
        /// </summary>
        public event WorkerEngineWithActionEventHandler AfterGenerate_ExecuteInstallation_BeforeComponents_Handler;

        /// <summary>
        /// Provoque l'évènement AfterGenerate_ExecuteInstallation_BeforeComponents_Handler
        /// </summary>
        /// <param name="target"></param>
        /// <param name="ActionId"></param>
        protected virtual void AfterGenerate_ExecuteInstallation_BeforeComponents(DreamWorkerEngine target, WorkerActionId ActionId)
        {
            if (AfterGenerate_ExecuteInstallation_BeforeComponents_Handler != null)
                AfterGenerate_ExecuteInstallation_BeforeComponents_Handler(target, ActionId);
        }
    }
}
